package com.example.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.EvalMapper;
import com.example.entity.Evaluate;
import com.example.service.EvaluateService;
import com.example.vo.EvaluateVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service //对象注解
public class EvaluateServiceImpl extends ServiceImpl<EvalMapper, Evaluate> implements EvaluateService {

    @Resource
    private EvalMapper evalMapper;

    /**
     * 查询所有的分页
     * @param currentPage 现在第几页
     * @param pageSize   每页多少条
     * @return
     */
    @Override
    public IPage<Evaluate> getPage(int currentPage, int pageSize) {
        IPage<Evaluate> page =new Page<>(currentPage,pageSize);
        evalMapper.selectPage(page,null);//null是查询条件
        return page;
    }

    /**
     * 联合查询
     * @param id
     * @return
     */
    @Override
    public List<EvaluateVo> lianhe(Integer id) {
        return evalMapper.AssociatedQuery(id);
    }

    @Override
    public List<Evaluate> FuzzyQuerY(String FuzzyEva) {
        return evalMapper.FuzzyQuery(FuzzyEva);
    }
}
